<%-- 
    Document   : index
    Created on : Mar 27, 2010, 7:34:27 PM
    Author     : numessi
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="biz.source_code.miniTemplator.MiniTemplator"%>

<%
    if(session.getAttribute("User") != null) {
            String templatePath = "template/splasher/";
            String templateFileName = "index.html";
            String aPath = pageContext.getServletContext().getRealPath(request.getRequestURI()).replace('\\', '/');
            String cPath = request.getContextPath();
            if (cPath.length() > 1) {
                int f1 = aPath.lastIndexOf(cPath);
                aPath = aPath.substring(0, f1) + aPath.substring(f1 + cPath.length());
            }
            aPath = aPath.substring(0, aPath.lastIndexOf('/') + 1);

            MiniTemplator templator = new MiniTemplator(aPath + templateFileName);
         
         templator.setVariable("title", "Bumblebee Resort Management");
         templator.setVariable("fullname", (String) session.getAttribute("FullName"));
         templator.setVariable("templatePath", templatePath);
         

         if (session.getAttribute("UserRole").equals("LocalManager")) {
             templator.addBlock("RoomManagementNav", false);
             templator.addBlock("SalesManagementNav", false);
             templator.addBlock("StatisticsNav", false);
             templator.addBlock("Content", false);
             out.print(templator.generateOutput());
         } else if (session.getAttribute("UserRole").equals("NationalManager")) {
             templator.addBlock("RoomManagementNav", false);
             templator.addBlock("SalesManagementNav", false);
             templator.addBlock("StatisticsNav", false);
             templator.addBlock("Content", false);
             out.print(templator.generateOutput());
         } else if (session.getAttribute("UserRole").equals("SalesManager")) {
             templator.addBlock("SalesManagementNav", false);
             templator.addBlock("RoomManagementNav", false);
             templator.addBlock("Content", false);
             out.print(templator.generateOutput());
         } 
         
    } else {
        response.sendRedirect("login.jsp");
    }

%>